package edu.sctu.practice.class02.shuqiqi.assign.assign03.Two;

/**
 * Created by admin on 2015/11/4.
 */
public class ComparableCylinder extends Cylinder implements Comparable {
public ComparableCylinder(double radius, int height) {
        this.heigh = height;
        this.radius = radius;
    }
    @Override
    public int compareTo(Object o) {
        if (getArea() > ((ComparableCylinder) o).getArea()) {
            return 0;
        } else {
            return 1;
        }
    }
    public double getArea() {

        double area = Math.PI * radius * radius * heigh;
        System.out.println("面积为："+area);
        return area;
    }
}
